//平台属性相关接口的请求函数
import request from '@/utils/request'
import type { AttrListModel, AttrModel, AttrValueModel, CategoryIdsModel } from './model/AttrModel'

enum Api{
    // GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
    GetAttrList='/admin/product/attrInfoList',
    // POST /admin/product/saveAttrInfo
    //修改和添加
    SaveAttr=`/admin/product/saveAttrInfo`,
    //删除
    // DELETE /admin/product/deleteAttr/{attrId}
    DeleteArr=`/admin/product/deleteAttr`

}
//获取列表属性
export const getAttrListApi =(params:CategoryIdsModel)=>{
    return request.get<any,AttrListModel>(Api.GetAttrList+ `/${params.category1Id}/${params.category2Id}/${params.category3Id}`)
}
//添加和修改属性
export const saveAttrApi=(attr:AttrModel)=>{
    return request.post(Api.SaveAttr,attr)
}
//删除属性
export const deleteAttrApi=(id:number)=>{
    return request.delete(Api.DeleteArr +`${id}`)
}